package surfing.chatting.ui.panel;

import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import surfing.chatting.client.Client;
import surfing.chatting.ui.dialog.DialogMyDetails;
import surfing.chatting.ui.frame.FrameChat;

public class PanelChatLeft extends JPanel {
	private static final long serialVersionUID = -2289844940206184121L;
	private JLabel headLabel = new JLabel();

	public void setHeadImage(ImageIcon icon) {
		icon= new ImageIcon(icon.getImage().getScaledInstance(40, 40, Image.SCALE_SMOOTH));
		headLabel.setIcon(icon);
	}
	public void setHeadLabel(JLabel headLabel) {
		this.headLabel = headLabel;
	}

	public PanelChatLeft() {
		super();
		this.setPreferredSize(new Dimension(400, 800));
		ImageIcon icon = new ImageIcon(
				Client.me.getHeadIcon().getImage().getScaledInstance(40, 40, Image.SCALE_SMOOTH));
		headLabel.setIcon(icon);
		headLabel.setBounds(20, 10, 50, 50);
		this.add(headLabel);
		headLabel.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseEntered(MouseEvent e) {
				headLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
			}

			@Override
			public void mouseClicked(MouseEvent e) {
				new DialogMyDetails(FrameChat.getjFrame());

			}
		});

	};

}
